/*
 * @Author: wangshuixin 2412658453@qq.com
 * @Date: 2024-11-15 16:57:56
 * @LastEditors: luosi 1297957337@qq.com
 * @LastEditTime: 2024-11-28 14:54:26
 * @FilePath: \sr_system_manager_ui\src\api\resultsManagements\PatentApi.ts
 * @Description: 专利软著模块Api
 */
import request from '@/utils/request'
import { PatentPageReqDTO } from './types'
import type { PatentListResp } from '@/types/resultsManagement'
import type { PaginationQueryUniteRespDTO, AppStateChangeRespDTO } from '@/types/index'

// 专利软著 分页查询
export function getPatentListApi(params: PatentPageReqDTO) { 
  return request<PaginationQueryUniteRespDTO<PatentListResp>>({
    url: `/achv/patent/page`,
    method: 'post',
    data: params
  })
}

// 获取 专利软著 详情
export function getPatentDetailApi(params) { 
  return request<PatentListResp>({
    url: `/achv/patent/detail`,
    method: 'post',
    data: params
  })
}

// 创建 专利软著 详情
export function createPatentDetailApi(params) {
  return request<AppStateChangeRespDTO>({
    url: `/achv/patent/create`,
    method: 'post',
    data: params
  })
}

// 更新 专利软著 详情
export function updatePatentDetailApi(params) {
  return request<AppStateChangeRespDTO>({
    url: `/achv/patent/update`,
    method: 'post',
    data: params
  })
}

/**
 * 导出 专利软著
 * @param {number} unStatus 不包含状态
 * @param {string} createdBy 创建人id
 * @param {string} departmentId 部门id
 * @param {string} idList 导出id
*/
export function exportPatentApi(params: { unStatus?: number, createdBy?: string, departmentId?: string, idList?: string[] }) {
  return request({
    url: `/achv/patent/export`,
    method: 'post',
    responseType: 'blob',
    data: params
  })
}